﻿<%@ Page Title="STOCK REQUISITION" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="StockRequisition.aspx.cs" Inherits="SAP.PurchaseRequisition" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        Main.myUpdatePanelId = '<%= purchaseOrderUpdatePanel.ClientID %>';
        function openMultiItemDialog() {

            var tabid = '<%= Request.QueryString["requestType"] %> ';
            javascript: Main.openCustomDialog('../Popup_MultiItems.aspx?requestType=' + tabid, 600, 610, "");
        }
        function openSingItemDialog(No) {

            var tabid = '<%= Request.QueryString["requestType"] %> ';          
            javascript: Main.openCustomDialog('../Popup_EditItem.aspx?requestType=' + tabid + '&id=' +No, 600, 610, "");
        }
    </script>
    <asp:UpdatePanel ID="purchaseOrderUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="contentData" style="padding-left: 15px;">
                <%--<div id="menu-action" style="margin-left: -15px;">
                    <ul>
                        <li><a href="#">
                            <img alt="" src="/skin/icon/preview.png" /></a></li>
                        <li><a href="#">
                            <img alt="" src="/skin/icon/print.png" /></a></li>
                        <li><a href="#">
                            <asp:ImageButton ImageUrl="/skin/icon/email.png" runat="server" ID="btnEmail"  CssClass="imagebutton"
                                Height="22px" onclick="btnEmail_Click"  OnClientClick="Dialog.showLoader();" /> </a></li>
                         
                        <li>
                            <asp:HyperLink ID="linkNew" runat="server"> <asp:Image ID="Image8" runat="server" ImageUrl="~/skin/icon/addnew.png" /></asp:HyperLink>
                        </li>

                        <li>
                            <asp:HyperLink ID="linkFirst" runat="server"> <asp:Image ID="Image4" runat="server" ImageUrl="~/skin/icon/first.png" /></asp:HyperLink>
                        </li>
                        <li>
                            <asp:HyperLink ID="linkPrevious" runat="server"> <asp:Image ID="Image5" runat="server" ImageUrl="~/skin/icon/previous.png" /></asp:HyperLink>
                        </li>
                        <li>
                            <asp:HyperLink ID="linkNext" runat="server"> <asp:Image ID="Image6" runat="server" ImageUrl="~/skin/icon/next.png" /></asp:HyperLink>
                        </li>
                        <li>
                            <asp:HyperLink ID="linkLast" runat="server"> <asp:Image ID="Image7" runat="server" ImageUrl="~/skin/icon/last.png" /></asp:HyperLink>
                        </li>
                 </ul>                    
                </div>--%>
                <div class="clear">
                </div>
                <div id="title-form" style="border-bottom: 2px solid black;">
                    <h2>
                        <asp:Label ID="lb_RequestType" runat="server" Text="[]"></asp:Label>
                    </h2>
                    <asp:Label BackColor="Red" ID="lblResults" runat="server" />
                </div>
                <div id="header-form">
                    <div class="left">
                        <table class="detail_table">
                            <tr>
                                <td class="detail_table_td_100" style="border-bottom: dotted 1px #808080;">
                                    <span>Requester</span>
                                    </td>
                                <td>
                                    <asp:TextBox ID="txtVendor" runat="server" Enabled="False"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_100" style="border-bottom: dotted 1px #808080;">
                                    <span>Request Name</span>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtName" runat="server" Enabled = "false"></asp:TextBox>
                                </td>
                            </tr>
                            <tr style="display:none">
                                <td class="detail_table_td_100" style="border-bottom: dotted 1px #808080;">
                                    <asp:Label ID="lb_ReqType" runat="server" Text="Requisition Type"></asp:Label>
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlRequisitionType" runat="server" Enabled="false">
                                        <asp:ListItem Text="Food Request" Value="F"></asp:ListItem>
                                        <asp:ListItem Text="Beverage Request" Value="B"></asp:ListItem>
                                        <asp:ListItem Text="Purchase Request" Value="P"></asp:ListItem>
                                        <asp:ListItem Text="Food Transfer" Value="E"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_100" style="border-bottom: dotted 1px #808080;">
                                    <asp:Label ID="lb_FromWhs" runat="server" Text="From Store "></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtFromWarehouse" runat="server" class="txtDate" 
                                        Enabled="False"></asp:TextBox>
                                    <asp:HyperLink ID="hl_ChooseWhs" NavigateUrl="javascript:Main.openDialog('../Popup_EditWareHouse.aspx?id=-1','');" runat="server">
                                                 <asp:Image ID="imgItems4" runat="server" ImageUrl="~/skin/images/item-pointer.gif" />                           
                                    </asp:HyperLink>
                                    <asp:Label ID="lb_WhsCode" runat="server" Text="WhsCode" Visible="True"></asp:Label>
                                </td>
                            </tr>

                            <tr>
                                <td class="detail_table_td_100" style="border-bottom: dotted 1px #808080;">
                                    <asp:Label ID="lb_ToWhs" runat="server" Text="To Store "></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_ToWhs" runat="server" class="txtDate" 
                                        Enabled="False"></asp:TextBox>
                                    <asp:HyperLink ID="hl_ChooseToWhs" NavigateUrl="javascript:Main.openDialog('../Popup_EditWareHouse.aspx?id=-2','');" runat="server">
                                                 <asp:Image ID="imgItems5" runat="server" ImageUrl="~/skin/images/item-pointer.gif" />                           
                                    </asp:HyperLink>
                                    <asp:Label ID="lb_ToWhsCode" runat="server" Text="ToWhsCode" Visible="True"></asp:Label>
                                </td>
                            </tr>

                        </table>
                    </div>
                    <div class="right">
                        <table class="detail_table">
                            <tr>
                                <td class="detail_table_td_150" style="border-bottom: dotted 1px #808080;">
                                    <span>No</span>&nbsp;</td>
                                <td>
                                    <asp:TextBox ID="txtNo" runat="server" Enabled="false" Text=""></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_150" style="border-bottom: dotted 1px #808080;">
                                    <span>Status</span>
                                </td>
                                <td>
                                    <asp:TextBox Enabled="false" ID="txtStatus" Text="" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_150" style="border-bottom: dotted 1px #808080;">
                                    <span>Posting Date</span>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtPostingDate" runat="server" CssClass="txtDate"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_150" style="border-bottom: dotted 1px #808080;">
                                    <span>Valid Util</span>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtDueDate" runat="server" CssClass="txtDate"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_150" style="border-bottom: dotted 1px #808080;">
                                    <span>Required Date</span>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtDocumentDate" runat="server" CssClass="txtDate"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="clear">
                </div>
                <div id="content-form">
                    <div id="tabs">
                        <ul>
                            <li><a href="#tabs-1">Contents</a></li>
                        </ul>
                        <div id="tabs-1" style="overflow: auto; height: 290px; margin-top: 0px;">
                            <asp:Button ID="btnAddRecord" Text="Add" runat="server" 
                                OnClick="_btnAddRecord_Click" Width="86px" Visible="False" />
                            <asp:ImageButton ID="btn_AddMultiItems" runat="server" 
                            OnClientClick="openMultiItemDialog();"
                                ImageUrl="~/skin/images/SAP_Add.png" />
                            <br />

                            <asp:ListView ID="lvContents" runat="server" OnItemInserted="lvContents_ItemInserted"
                                OnItemCommand="lvContents_ItemCommand" OnItemUpdating="lvContents_ItemUpdating"
                                ViewStateMode="Enabled" OnItemEditing="lvContents_ItemEditing">
                                <LayoutTemplate>
                                    <table class="data_table">
                                        <tr>
                                            <th id="thButtons" runat="server" style="width: 50px">
                                            </th>

                                            <th style="width: 20px">
                                                <span>#</span>
                                            </th>
                                            
                                            <th style="display: none">
                                                <span>DetID</span>
                                            </th>

                                            <th style="width: 70px">
                                                <span>Item Code</span>
                                            </th>
                                            <th style="width: 200px">
                                                <span>Description</span>
                                            </th>
                                            <th style="width: 100px">
                                                <span>Unit</span>
                                            </th>
                                            <th style="width: 50px">
                                                <span>Quantity</span>
                                            </th>
                                            <th style="display:none">
                                                <span>Store</span>
                                            </th>
                                           
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <tr>
                                        <td style="text-align: left">
                                            <asp:LinkButton ID="imgbEdit" runat="server" CommandName="Edit" Text="Edit" ImageUrl="~/skin/icon/edit_icon_mono.gif" />
                                            <asp:LinkButton ID="imgbDelete" runat="server" CommandName="DeleteItem" Text="Delete"
                                                ImageUrl="~/skin/icon/delete_icon_mono.gif" OnClientClick="return confirm('Are you sure you want to delete this row?');"
                                                ToolTip="Delete" />
                                        </td>

                                        <td style="text-align: left">
                                            <asp:Label runat="server" ID="lblNo" Text='<%#Eval("No")%>'></asp:Label>
                                        </td>

                                        <td style="display: none">
                                            <asp:Label runat="server" ID="Label1" Text='<%#Eval("detID")%>'></asp:Label>
                                        </td>

                                        <td style="text-align: left">
                                            <%--<asp:HyperLink ID="litem" runat="server" NavigateUrl='<%# "../Inventory/ItemMasterData.aspx?itemcode=" + Eval("ItemCode").ToString() %>' >
                                                <asp:Image ID="Image2" runat="server" ImageUrl="~/skin/icon/link.png"/>                                            
                                            </asp:HyperLink>--%>
                                            <asp:Label runat="server" ID="lblCode"><%#Eval("ItemCode") %></asp:Label>
                                        </td>
                                        <td style="text-align: left">
                                            <asp:Label runat="server" ID="lblDescription" ><%#Eval("Dscription")%></asp:Label>
                                        </td>
                                        <td style="text-align: left">
                                            <asp:Label runat="server" ID="lblUnit" Text='<%# Eval("invntryuom") %>'></asp:Label>
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label runat="server" ID="lblQuantity" Text='<%# Eval("Quantity") %>'></asp:Label>
                                        </td>
                                        <td style="display:none">
                                            <asp:Label runat="server" ID="lblWhse"><%#Eval("WhsCode")%></asp:Label>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <tr>
                                        <td style="text-align: left">
                                            <asp:LinkButton ID="imgbUpdate" runat="server" CommandName="Update" Text="Update"
                                                ImageUrl="~/skin/icon/save_icon_mono.gif" CausesValidation="true" ValidationGroup="vgrpSaveContact" />
                                            <asp:LinkButton ID="imgbCancel" runat="server" CommandName="CancelUpdate" Text="Cancel"
                                                ImageUrl="~/skin/icon/undo_icon_mono.gif" CausesValidation="false" />
                                        </td>

                                        <td>
                                            <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' />
                                        </td>
                                        <td style="display: none">
                                            <asp:Label ID="lbldetID" runat="server" Text='<%# Bind("detID") %>' />
                                        </td>
                                        <td style="text-align: left">
                                       <%--  NavigateUrl='WebForm3.aspx?tui=323'--%> 
                                            <asp:Label ID="lblCode" runat="server" Text='<%# Bind("ItemCode") %>' />
                                            <asp:HyperLink ID="linkItems"                                             
                                            NavigateUrl='<%# String.Format("javascript:openSingItemDialog({0})",Eval("No").ToString())%>'
                                            
                                                runat="server"> <asp:Image ID="imgItems" runat="server" ImageUrl="~/skin/images/item-pointer.gif" /></asp:HyperLink>
                                        </td>

                                        

                                        <%--'<%# String.Format("javascript:Main.openCustomDialog(\"../Popup_EditItem.aspx?id={0},600,610)", Eval("No").ToString()+"&requestType=1\"")%>'--%>


                                        <td style="text-align: left">
                                            <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Dscription")%>' />
                                        </td>
                                        <td>
                                            <asp:Label ID="lbUnit"  runat="server" Text='<%#Eval("invntryuom")%>' />
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtQuantity" Style="text-align: right" runat="server" Text='<%#Eval("Quantity")%>' />
                                        </td>
                                        <td style="display:none"">
                                            <asp:Label runat="server" ID="lblWhse" Text='<%#Bind("WhsCode")%>' />
                                            <asp:HyperLink ID="linkWarehouseLoad" NavigateUrl='<%# String.Format("javascript:Main.openDialog(\"../Popup_EditWareHouse.aspx\",{0})", "\"id=" + Eval("No").ToString()+"\"")%>'
                                                runat="server"> <asp:Image ID="imgWarehouseLoad" runat="server" ImageUrl="~/skin/images/item-pointer.gif" /></asp:HyperLink>
                                        </td>
                                    </tr>
                                </EditItemTemplate>
                               
                                <EmptyDataTemplate>
                                    <table class="data_table">
                                        <tr>
                                            <th>
                                                <span>#</span>
                                            </th>

                                            <th style="display: none">
                                                <span>Det ID</span>
                                            </th>
                                            <th>
                                                <span>Item Code</span>
                                            </th>
                                            <th>
                                                <span>Item Description</span>
                                            </th>
                                            <th>
                                                <span>Unit</span>
                                            </th>
                                            <th>
                                                <span>Quantity</span>
                                            </th>
                                            
                                            <th style="display:none">
                                                <span>Store</span>
                                            </th>
                                            
                                           
                                        </tr>
                                        <tr>
                                            <td colspan="5">
                                                <span>No Data</span>
                                            </td>
                                        </tr>
                                    </table>
                                </EmptyDataTemplate>
                            </asp:ListView>

                            <asp:DataPager ID="ProductListPagerCombo" runat="server" PagedControlID="lvContents"
                                PageSize="7" OnPreRender="ProductListPagerCombo_PreRender">
                                <Fields>
                                    <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" ShowFirstPageButton="True" ShowNextPageButton="False"
                                        ShowPreviousPageButton="False" />
                                    <asp:NumericPagerField />
                                    <asp:NextPreviousPagerField LastPageText="&gt;&gt;" ShowLastPageButton="True" ShowNextPageButton="False"
                                        ShowPreviousPageButton="False" />
                                </Fields>
                            </asp:DataPager>
                        </div>
                       
                    </div>
                    <br />
                    
                    
                    <div class="clear">
                    </div>
                    <div class="left">
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="clear">
                </div>
                <div id="footer-form">
                    <div>
               
                        <asp:ImageButton ID="btnAdd" runat="server" AlternateText="Save Draft" OnClientClick="Dialog.showLoader();"
                            CommandName="Login" Height="19px" Width="65px" ImageUrl="~/skin/images/SAP_SaveDraft.png"
                            OnClick="btnAdd_Click" />

                        <asp:ImageButton ID="btnUpdate" runat="server" AlternateText="button" 
                             Height="19px" Width="65px" 
                            ImageUrl="~/skin/images/SAP_update.png" onclick="btnUpdate_Click" 
                            OnClientClick="Dialog.showLoader();"/>  
                        <asp:ImageButton ID="btnSaveSubmit" runat="server" AlternateText="button" 
                             Height="19px" Width="93px" 
                            ImageUrl="~/skin/images/SAP_SaveSubmit.png" onclick="btnSaveSubmit_Click" 
                            OnClientClick="Dialog.showLoader();"/>                 
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
